const app = getApp()
Page({
  data: {
    datas: '',
    name: '',
    datass: '',
    price: 'XXX',
    phonenumber: '',
    loginShow: true,
  },

  getUserInfo(potion) {
    let user = my.getStorageSync({
      key: 'user'
    })
    if (user.data) {
      let data = new Date()
      let datass = data.getFullYear() + '年' + (data.getMonth() + 1) + '月' + data.getDate() + '日'
      let datas = data.getFullYear() + 1 + '年' + (data.getMonth() + 1) + '月' + data.getDate() + '日'
      let inforpeo = user.data
      console.log("时间：", potion)
      this.setData({
        datass: datass,
        price: potion.param,
        datas: datas,
        name: inforpeo.name
      })
    }
  },
  onLogin(data) {
    console.log('zxzxzx', data);
    if (data.login) {
      setTimeout(() => {
        this.getUserInfo(this.data.potion)
      }, 500)
    }
    this.setData({
      loginShow: data.loginShow
    })
  },

  onLoad(potion) {
    this.setData({
      potion
    })
    // let item = {
    //   createtime: data,  // 时间
    //   leaseTerm: Math.floor(this.data.trem_value / 30),// 租期
    //   allRent: this.data.buyOut / 100, // 总租金
    //   tit: this.data.tit, // 
    //   phone: this.data.phone,
    //   shopsVo: this.data.shops,
    //   userVo: my.getStorageSync({ key: 'user' }).data,}
  },
  onShow() {
    let user = my.getStorageSync({
      key: 'user'
    })
    if (user.data) {
      this.setData({
        loginShow: false
      })
      this.getUserInfo(this.data.potion)
    }
    this.setData({
      phonenumber: app.globalData.number
    })
  }
});